﻿//=======================================================
// 作者：KingSley
// 描述：
//=======================================================
using UnityEngine;
using System.Collections;

namespace Singleton
{
    class SceneStateManager
    {
        //单例模式
        private static SceneStateManager _instance;
        public static SceneStateManager GetInstacne
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new SceneStateManager();
                }

                return _instance;
            }
        }

        private ISceneState mState { get; set; }

        public void SetSceneState(ISceneState state)
        {
            //对上一个场景状态退出处理
            if (mState != null)
            {
                mState.EndScene();
            }
            mState = state;
            //对新场景状态进行开始处理
            if (mState != null)
            {
                mState.StartScene();
            }
        }


        public void UpdateSceneState()
        {
            if (mState != null)
            {
                mState.UpadteScene();
            }
        }
    }
}